//
//  PostIndexViewController.m
//  ELife
//
//  Created by  刘奇男 on 11-6-14.
//  Copyright 2011年 __MyCompanyName__. All rights reserved.
//

#import "PostIndexViewController.h"
#import "GameRootController.h"
#import "GetMyData.h"

@implementation PostIndexViewController

@synthesize menu;
NSArray *postText;


- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)dealloc
{
    [super dealloc];
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView
{
}
*/

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    [self.navigationItem setTitle:@"公告"];
    
    postText = [GetMyData getMarquees];
    [menu setDelegate:self];
    [menu setDataSource:self];
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retaineTicketBusinessRootControllerd subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}


#pragma mark - Table view delegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    // Return the number of sections.
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{    // Return the number of rows in the section.
    return postText.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
//	static NSString *kCellIdentifier = @"PostIndexCellID";
//    
//    
//	UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier];
//    if (cell == nil) {
//        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:kCellIdentifier] autorelease];
//    }
//    
//    // Configure the cell...'
////    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
//    
//    cell.textLabel.backgroundColor = [UIColor clearColor];
//    cell.textLabel.opaque = NO;
//    cell.textLabel.textColor = [UIColor blackColor];
//    cell.textLabel.highlightedTextColor = [UIColor whiteColor];
//    cell.textLabel.font = [UIFont boldSystemFontOfSize:16];
//    cell.textLabel.numberOfLines = 10;
//    cell.textLabel.text = [postText objectAtIndex:indexPath.row];
//    
//    return cell;
    static NSString *RES_CELL = @"ResultCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:RES_CELL];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:RES_CELL]
                autorelease];
        [cell addSubview:[[UILabel alloc] initWithFrame:CGRectMake(20.0f, 0.0f, 280.0f, 100.0f)]];
    }
    UILabel *dh = [[cell subviews] lastObject];
    dh.backgroundColor = [UIColor clearColor];
    dh.text =  [postText objectAtIndex:indexPath.row];
    dh.font = [UIFont systemFontOfSize:[UIFont smallSystemFontSize]];
//    dh.lineBreakMode = UILineBreakModeWordWrap;
    dh.numberOfLines = 0;
    return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{  
 	return 100;  
}  
@end
